<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>tagonenterhandler.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">tagonenterhandler.js</span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    <span class='nodesc'>No description.</span>
  </div>
  

        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_closure_goog_editor_plugins_tagonenterhandler.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/editor/plugins/tagonenterhandler.js">Git</a></li>
          </ol>
        </div>
</div>

<h2 class="g-first">File Location</h2>
  <div class="g-section g-tpl-20-80">
    <div class="g-unit g-first">
      <div class="g-c-cell code-label">/goog/editor/plugins/tagonenterhandler.js</div>
    </div>
  </div>
<hr/>


  <h2>Classes</h2>
 <div class="fn-constructor">
        <a href="class_goog_editor_plugins_TagOnEnterHandler.html">
          goog.editor.plugins.TagOnEnterHandler</a><br/>
        <div class="class-details">Plugin to handle enter keys. This subclass normalizes all browsers to use
the given block tag on enter.
</div>
 </div>
      
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>




  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.editor.plugins.TagOnEnterHandler.findAnchorInTraversal_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.editor.plugins.TagOnEnterHandler.</span><span class="entryName">findAnchorInTraversal_<span class="args">(<span class="arg">node</span>,&nbsp;<span class="arg">opt_useFirstChild</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
      </div>


     <div class="entryOverview">
       Finds the first A element in a traversal from the input node.  The input
node itself is not included in the search.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The node to start searching from.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_useFirstChild</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">Whether to traverse along the first child
    (true) or last child (false).</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>&nbsp;
            The first anchor node found in the search, or null if none
    was found.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_editor_plugins_tagonenterhandler.js.source.html#line736">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.editor.plugins.TagOnEnterHandler.joinTextNodes_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.editor.plugins.TagOnEnterHandler.</span><span class="entryName">joinTextNodes_<span class="args">(<span class="arg">node</span>,&nbsp;<span class="arg">moveForward</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
      </div>


     <div class="entryOverview">
       Joins node and its adjacent text nodes together.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The node to start joining.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">moveForward</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
        <div class="entryOverview">Determines whether to join left siblings (false)
    or right siblings (true).</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>&nbsp;
            The joined text node.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_editor_plugins_tagonenterhandler.js.source.html#line683">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.editor.plugins.TagOnEnterHandler.replaceWhiteSpaceWithNbsp_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.editor.plugins.TagOnEnterHandler.</span><span class="entryName">replaceWhiteSpaceWithNbsp_<span class="args">(<span class="arg">textNode</span>,&nbsp;<span class="arg">fromStart</span>,&nbsp;<span class="arg">isLeaveEmpty</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Replaces leading or trailing spaces of a text node to a single Nbsp.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">textNode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The text node to search and replace white spaces.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">fromStart</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
        <div class="entryOverview">Set to true to replace leading spaces, false to
    replace trailing spaces.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">isLeaveEmpty</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
        <div class="entryOverview">Set to true to leave the node empty if the
    text node was empty in the first place, otherwise put a Nbsp into the
    text node.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_editor_plugins_tagonenterhandler.js.source.html#line714">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.editor.plugins.TagOnEnterHandler.splitDomAndAppend_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.editor.plugins.TagOnEnterHandler.</span><span class="entryName">splitDomAndAppend_<span class="args">(<span class="arg">positionNode</span>,&nbsp;<span class="arg">positionOffset</span>,&nbsp;<span class="arg">node</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
      </div>


     <div class="entryOverview">
       Splits the DOM tree around the given node and returns the node containing
second half of the tree, which is appended after the old node.  The first
half of the tree is modified, but not removed from the DOM.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">positionNode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">Node to split at.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">positionOffset</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">Offset into positionNode to split at.  If
    positionNode is a text node, this offset is an offset in to the text
    content of that node.  Otherwise, positionOffset is an offset in to
    the childNodes array.  All elements with child index of  positionOffset
    or greater will be moved to the second half.  If positionNode is an
    empty element, the dom will be split at that element, with positionNode
    ending up in the second half.  positionOffset must be 0 in this case.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">Node to split.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>&nbsp;
            The node containing the second half of the tree.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_editor_plugins_tagonenterhandler.js.source.html#line666">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.editor.plugins.TagOnEnterHandler.splitDom_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.editor.plugins.TagOnEnterHandler.</span><span class="entryName">splitDom_<span class="args">(<span class="arg">positionNode</span>,&nbsp;<span class="arg">positionOffset</span>,&nbsp;<span class="arg">opt_root</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
      </div>


     <div class="entryOverview">
       Splits the DOM tree around the given node and returns the node
containing the second half of the tree. The first half of the tree
is modified, but not removed from the DOM.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">positionNode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">Node to split at.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">positionOffset</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">Offset into positionNode to split at.  If
    positionNode is a text node, this offset is an offset in to the text
    content of that node.  Otherwise, positionOffset is an offset in to
    the childNodes array.  All elements with child index of  positionOffset
    or greater will be moved to the second half.  If positionNode is an
    empty element, the dom will be split at that element, with positionNode
    ending up in the second half.  positionOffset must be 0 in this case.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_root</span>
        : <span class="type">Node=</span>
        <div class="entryOverview">Node at which to stop splitting the dom (the root
    is also split).</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>&nbsp;
            The node containing the second half of the tree.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_editor_plugins_tagonenterhandler.js.source.html#line591">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.editor.plugins.TagOnEnterHandler.trimTabsAndLineBreaks_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.editor.plugins.TagOnEnterHandler.</span><span class="entryName">trimTabsAndLineBreaks_<span class="args">(<span class="arg">string</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Trim the tabs and line breaks from a string.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">string</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">String to trim.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Trimmed string.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_editor_plugins_tagonenterhandler.js.source.html#line465">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.editor.plugins.TagOnEnterHandler.wrapInContainerW3c_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.editor.plugins.TagOnEnterHandler.</span><span class="entryName">wrapInContainerW3c_<span class="args">(<span class="arg">nodeName</span>,&nbsp;<span class="arg">position</span>,&nbsp;<span class="arg">container</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/DOM/Element">Element</a></span>
      </div>


     <div class="entryOverview">
       Wrap the text indicated by "position" in an HTML container of type
"nodeName".

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">nodeName</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">Type of container, e.g. "p" (paragraph).</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">position</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>
        <div class="entryOverview">The W3C cursor position object
    (from getCursorPositionW3c).</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">container</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The field containing position.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="https://developer.mozilla.org/en/DOM/Element">Element</a></span>&nbsp;
            The container element that holds the contents from
    position.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_editor_plugins_tagonenterhandler.js.source.html#line355">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>






      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Directory plugins</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">File Reference</h2>
            <div id="sideFileIndex" rootPath="" current="/goog/editor/plugins/tagonenterhandler.js"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
